HAL EXTI migration: List of applicable concepts

This section provides information about the HAL EXTI applicable architecture concepts.

Concepts for EXTI

Concept

Description

Separation of initialization and configuration functions

In HAL2, the HAL_EXTI_Init() is used to initialize the HAL EXTI handle and associate it to the given EXTI line.

The HAL_EXTI_SetConfig() is configure the selected EXTI line when it is configurable.

Removal and conversion of init structure to configuration structure

The initialization structure has been removed from the handle and converted to a configuration structure given as parameter to the HAL_EXTI_SetConfig().

Renaming of the handle structure

The handle structure EXTI_HandleTypeDef has been renamed to hal_exti_handle_t.

Introduction of HAL user data set/get APIs

Two functions to set and get user data are available: HAL_EXTI_SetUserData() and HAL_EXTI_GetUserData().

HAL implementation with LL inline functions

HAL EXTI APIs now rely on LL APIs rather than performing direct register access.

Define statements and enumerations redirected to LL equivalents

HAL EXTI define statements and enumerations are based on LL define statements.

Revised and optimized HAL state machine

Update the global state machine to return

  • HAL_EXTI_STATE_RESET

  • HAL_EXTI_STATE_INIT

  • HAL_EXTI_STATE_IDLE

  • HAL_EXTI_STATE_ACTIVE

Revised and optimized HAL API status returns

The HAL EXTI functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_OK: in case of a successfully completed operation.

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL EXTI driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

The parameters and state are checked using ASSERT_DBG_STATE and ASSERT_DBG_PARAM macro.

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including EXTI instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL EXTI functions start with HAL_EXTI. All HAL EXTI enumerations and structures start with hal_exti.